<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="../../aui/css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/mui.picker.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/mui.poppicker.css"/>
    <link rel="stylesheet" type="text/css" href="../../aui/css/aui-iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/css.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/swiper-3.3.1.min.css"/>

</head>
<body>
<div v-cloak id="app" class="main2">
    <img :src="avatar" class="pingjiabg blur" alt="">
    <div id="wraps" class="flex-wrap bgn flex-vertical">
        <header class="nobg noborder">
            <ul>
                <li class="active">
                    <i onclick="back()" class="icon iconfont icon-back"></i>
                    <span>提交评价</span>
                </li>
            </ul>
        </header>
        <div class="pingjias">
            <div class="pingjiastitle">
                <span>对Ta的印象</span>
                <i class="icon iconfont icon-close" onclick="back()"></i>
            </div>
            <div class="pingjiasbody">
                <div class="pingjiasbody_img">
                    <img :src="avatar" alt="">
                </div>
                <div class="pingjiasbody_bt">
                    <span>{{nickname}}</span>
                    <div v-if="gender==2" class="sex_and_age">
                        <i class="icon iconfont icon-nan2"></i>
                        <em>{{age}}</em>
                    </div>
                    <div v-else class="sex_and_age">
                        <i class="icon iconfont icon-woman"></i>
                        <em>{{age}}</em>
                    </div>
                </div>
<!--                <div class="rongyu">-->
<!--                    <span>信誉值：{{score}}</span>-->
<!--                </div>-->
<!--                <div class="pingjialist">-->
<!--                    <div v-for="(item,index) in pingfenlist" :class="scores==item.pingfen?'active':''"-->
<!--                         class="pingjialistitem" @click="checkscore(item.pingfen)">-->
<!--                        {{item.name}}-->
<!--                    </div>-->
<!--                </div>-->
                <div class="pingjialist pingjialist2">
                    <div v-for="(item,index) in pingfenlist"  :class="scores==item.pingfen?'active':''"
                         class="pingjialistitem" @click="checkscore(item.pingfen)">
                        {{item.name}}
                        <!--                                <div class="aui-badge">{{item.count}}</div>-->
                    </div>
                </div>
                <div class="my_logout mt20 mb30" @click="pingjia">
                    提交评价
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="../../script/mui.min.js"></script>
<script src="../../script/mui.picker.js"></script>
<script src="../../script/mui.poppicker.js"></script>
<script src="../../aui/js/aui.js"></script>
<script src="../../script/vue2.js"></script>
<script src="../../script/vue-resource.min.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/city.data-3.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    apiready = function () {
        function lt(id, xm, tx) {
            api
            api.openWin({
                reload: true,
                name: 'kaolv',
                url: 'widget://html/win_chat.html',
                pageParam: {
                    id: id,
                    zh: xm,
                    tx: tx
                },
                vScrollBarEnabled: false,
            });
            if ($api.getStorage('id') == id) {
            } else {
                var rong = api.require('rongCloud2');
                rong.clearMessagesUnreadStatus({
                    conversationType: 'PRIVATE',
                    targetId: id
                }, function (ret, err) {
                })
            }
            api.sendEvent({
                name: 'hhxx'
            });
        }

        var main = new Vue({
            el: "#app",
            data: {
                birthday: api.pageParam.birthday,
                province: '',
                city: '',
                country: '',
                img: '',
                uid: api.pageParam.uid,
                id: api.pageParam.id,
                orderno: api.pageParam.orderno,
                avatar: ajaxUrl + api.pageParam.avatar,
                nickname: api.pageParam.nickname,
                age: api.pageParam.age,
                score: api.pageParam.score,
                gender: api.pageParam.gender,
                grade: '',
                scores: '',
                pingfenlist: [],
            },
            mounted: function () {
                var that = this;
                // this.getmessage()
                console.log("===========");
                console.log(that.id);
                that.getpingfen()
            },

            methods: {
                checkscore: function (e) {
                    this.scores = e
                    this.grade = e
                },
                pingjia: function (e) {
                    var that = this;
                    if (this.grade == '') {
                        api.toast({msg: '打个分吧', location: 'middle'});
                        return
                    }
                    showProgress();
                    var token = $api.getStorage('userInfo').token
                    console.log(that.orderno);
                    console.log(that.grade);
                    api.ajax({
                        url: ajaxRoute.meetingcomment,
                        method: 'post',
                        data: {
                            values: {
                                token: token,
                                orderno: that.orderno,
                                grade: that.grade
                            }
                        }
                    }, function (res, err) {
                        // console.log("评价测试");
                        console.log(JSON.stringify(res));
                        if (res.code == 1) {
                            api.sendEvent({
                                name: 'pingjiaok',
                            });
                            back()
                        } else {
                            api.hideProgress();
                            api.toast({msg: res.msg, location: 'middle'});
                        }
                    });
                },
                yaoqing: function () {
                    var that = this;
                    showProgress();
                    var token = $api.getStorage('userInfo').token
                    api.ajax({
                        url: ajaxRoute.accept,
                        method: 'post',
                        data: {
                            values: {
                                token: token,
                                orderno: that.orderno
                            }
                        }
                    }, function (res, err) {
                        console.log("接受邀请返回信息");
                        console.log(that.uid);
                        console.log(that.nickname);
                        console.log(that.avatar);
                        console.log(JSON.stringify(res));
                        if (res.code == 1) {
                            lt(that.uid, that.nickname, that.avatar)
                        } else {
                            api.hideProgress();
                            api.toast({msg: res.msg, location: 'middle'});
                        }
                    });
                },
                getpingfen: function () {
                    var that = this;
                    showProgress();
                    var token = $api.getStorage('userInfo').token
                    console.log(that.uid);
                    console.log("评分s");
                    api.ajax({
                        url: ajaxRoute.commentlist,
                        method: 'post',
                        data: {
                            values: {
                                token: token,
                                uid: that.uid
                            }
                        }
                    }, function (res, err) {
                        if (res.code == 1) {
                            console.log('对策可是');
                            var list = res.data
                            console.log(JSON.stringify(list));
                            var list3=[]
                            // lt(that.uid, that.nickname, that.avatar)
                            Object.keys(list).forEach(function (key) {
                                var list2 = {}
                                list2.pingfen = key
                                list2.name = list[key]
                                list3.push(list2)
                            });
                            console.log(JSON.stringify(list3));
                            that.pingfenlist = list3
                        } else {
                            api.hideProgress();
                            api.toast({msg: res.msg, location: 'middle'});
                        }
                    });
                },
                getmessage: function () {
                    var that = this;
                    showProgress();
                    var token = $api.getStorage('userInfo').token
                    api.ajax({
                        url: ajaxRoute.pushinfo,
                        method: 'post',
                        data: {
                            values: {
                                token: token,
                                id: that.uid
                            }
                        }
                    }, function (res, err) {
                        if (res.code == 1) {
                            console.log(JSON.stringify(res));
                            that.gender = res.data.gender
                            that.birthday = res.data.birthday
                            that.province = res.data.province
                            that.city = res.data.city
                            that.country = res.data.country
                            that.avatar = ajaxUrl + res.data.avatar
                            that.nickname = res.data.nickname
                        } else {
                            api.hideProgress();
                            api.toast({msg: res.msg, location: 'middle'});
                        }
                    });
                },
            },
            filters: {
                getsex: function (e) {
                    if (e) {
                        return '男'
                    } else {
                        return '女'
                    }
                },
                filtersImg: function (img) {
                    var imgs = ajaxUrl + '/' + img
                    console.log(imgs)
                    return imgs;
                }
            }
        })
    }
    // var main = new Vue({
    //     el: "#app",
    //     data: {
    //         birthday: '',
    //         province: '',
    //         city: '',
    //         country: '',
    //         img: '',
    //         uid: '',
    //         id: '',
    //         orderno: '',
    //         gender: '',
    //         avatar: '',
    //         nickname: '',
    //         pingfenlist: [
    //             {
    //                 name: '一般',
    //                 pingfen: 0
    //             }, {
    //                 name: '及格',
    //                 pingfen: 60
    //             }, {
    //                 name: '良好',
    //                 pingfen: 80
    //             }, {
    //                 name: '优秀',
    //                 pingfen: 100
    //             }
    //         ],
    //         score: -1,
    //         grade: 0
    //     },
    //     mounted: function () {
    //         var that = this;
    //         // this.getmessage()
    //         console.log("===========");
    //         console.log(that.id);
    //     },
    //
    //     methods: {
    //         checkscore: function (e) {
    //             console.log(e);
    //             this.score = e
    //             this.grade = e
    //         },
    //         pingjia: function (e) {
    //             var that = this;
    //             if (this.grade == 0) {
    //                 // api.toast({msg: '打个分吧', location: 'middle'});
    //                 return
    //             }
    //             showProgress();
    //             var token = $api.getStorage('userInfo').token
    //             console.log(that.orderno);
    //             console.log(that.grade);
    //             api.ajax({
    //                 url: ajaxRoute.judge,
    //                 method: 'post',
    //                 data: {
    //                     values: {
    //                         token: token,
    //                         orderno: that.orderno,
    //                         grade: that.grade
    //                     }
    //                 }
    //             }, function (res, err) {
    //                 console.log(JSON.stringify(res));
    //                 if (res.code == 1) {
    //                     api.sendEvent({
    //                         name: 'pingjiaok',
    //                     });
    //                     back()
    //                 } else {
    //                     api.hideProgress();
    //                     api.toast({msg: res.msg, location: 'middle'});
    //                 }
    //             });
    //         },
    //         yaoqing: function () {
    //             var that = this;
    //             showProgress();
    //             var token = $api.getStorage('userInfo').token
    //             api.ajax({
    //                 url: ajaxRoute.accept,
    //                 method: 'post',
    //                 data: {
    //                     values: {
    //                         token: token,
    //                         orderno: that.orderno
    //                     }
    //                 }
    //             }, function (res, err) {
    //                 console.log("接受邀请返回信息");
    //                 console.log(that.uid);
    //                 console.log(that.nickname);
    //                 console.log(that.avatar);
    //                 console.log(JSON.stringify(res));
    //                 if (res.code == 1) {
    //                     lt(that.uid, that.nickname, that.avatar)
    //                 } else {
    //                     api.hideProgress();
    //                     api.toast({msg: res.msg, location: 'middle'});
    //                 }
    //             });
    //         },
    //         getmessage: function () {
    //             var that = this;
    //             showProgress();
    //             var token = $api.getStorage('userInfo').token
    //             api.ajax({
    //                 url: ajaxRoute.pushinfo,
    //                 method: 'post',
    //                 data: {
    //                     values: {
    //                         token: token,
    //                         id: that.uid
    //                     }
    //                 }
    //             }, function (res, err) {
    //                 if (res.code == 1) {
    //                     console.log(JSON.stringify(res));
    //                     that.gender = res.data.gender
    //                     that.birthday = res.data.birthday
    //                     that.province = res.data.province
    //                     that.city = res.data.city
    //                     that.country = res.data.country
    //                     that.avatar = ajaxUrl + res.data.avatar
    //                     that.nickname = res.data.nickname
    //                 } else {
    //                     api.hideProgress();
    //                     api.toast({msg: res.msg, location: 'middle'});
    //                 }
    //             });
    //         },
    //     },
    //     filters: {
    //         getsex: function (e) {
    //             if (e) {
    //                 return '男'
    //             } else {
    //                 return '女'
    //             }
    //         },
    //         filtersImg: function (img) {
    //             var imgs = ajaxUrl + '/' + img
    //             console.log(imgs)
    //             return imgs;
    //         }
    //     }
    // })
</script>

</html>
